
let db = require('../utils/DB');//数据库
let to = require('../utils/await-to-js');
let { SUCCESS, ERROR } = require('../utils/result');//结果
let { HOST } = require('../utils/CONSTANT');//常量模块

//商品橱窗
function winModel() {
    return async (req, res) => {
        let [err, data] = await to(db.query(`SELECT a.goods_id,b.goods_name,b.goods_price,CONCAT(?,b.image_url) as image_url FROM win_location as a
        LEFT JOIN goods_list as b
        ON a.goods_id=b.goods_id`, [HOST]));
        err ? ERROR(res, '商品橱窗查询失败', err) : SUCCESS(res, data);
    };
}


module.exports = winModel;